import cn.cvs.dao.SysUserMapper;
import cn.cvs.pojo.SysUser;
import cn.cvs.service.SysUserServlce;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SysUserMapperTest {

    @Test
    public void findByAccount() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SysUserMapper sysUserMapper = context.getBean(SysUserMapper.class);
        SysUser sysUser = sysUserMapper.findByAccount("test001");
        System.out.println(sysUser.getRealName());
    }

    @Test
    public void login() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SysUserServlce userServlce = context.getBean(SysUserServlce.class);
        SysUser sysUser =userServlce.login("400881","123456");
        System.out.println(sysUser !=null ? sysUser.getRealName() : "用户名或者密码错误");
    }
}